<template>
  <el-container>
    <el-container>
      <el-header>
        <el-row type="flex" class="row-bg" justify="end" align="middle" style="height:100%">
          <el-col :span="2">
            <el-dropdown @command="handleCommand">
              <span class="el-dropdown-link">
                {{ account }}<i class="el-icon-arrow-down el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item command="/newRegistration" icon="el-icon-user-solid">
                  个人资料</el-dropdown-item>
                <el-dropdown-item icon="el-icon-s-unfold" command="loginOut"> 退出登录</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-col>
        </el-row>
      </el-header>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
    data() {
        return {
            account: '',
        }
    },
    methods: {
        handleCommand(command) {
            if (command === 'loginOut') {
                this.logout();
            }
        },
        logout() {
            localStorage.removeItem("authentication")
            this.$router.push('/login')
        }
    },
    created() {
    },
    mounted() {
    }
}
</script>

<style scoped>
.el-header {
  background-color: #fff;
}

.el-main {
  background-color: #f5f9ff;
}
</style>